#!/bin/sh

path=./mp4/
suffix=mp4

for file in $(ls ${path})
do
	if [ -d ${file} ];then
		echo ${file}' is directory'
	else
		#echo ${file}' is file'
		filename="${file%.*}"
		extension="${file##*.}"

		# 判断字符串是否相等
		if [ "${suffix}" = "${extension}" ];then
			`ffmpeg -i ./mp4/${file} -ss 0.1 -f image2 ./img/${file%.*}.png -y`
		else
			echo ${file}' not is mp4'
		fi
	fi
done

